﻿using System.IO;

namespace LD
{
    public class AppRoot
    {
        public void LoadCache()
        {
            Cache.LoadCache();
            if (!Cache.Exists(CONST.SFC_SW))
                Cache.SetCache(CONST.SFC_SW, true);
            if (!Cache.Exists(CONST.HIVE_SW))
                Cache.SetCache(CONST.HIVE_SW, true);

            string filePath = Path.Combine(Appbus.BasePath, "Data");
            if (!Directory.Exists(filePath))
                Directory.CreateDirectory(filePath);

            Cache.SaveCache();
        }
        public void LoadPartNo()
        {
            //获取当前机种
            var currentPartNo = Cache.GetCache("CurrentPartNo");
            if (currentPartNo == null)
            {
                //默认建立一个机种
                currentPartNo = "LD";
            }

            PartNoHelper.Instance.Load(currentPartNo.ToString());
        }
        public void LoadPlcAdr()
        {
            PlcCommManger.Instance.Load();
        }
        public void Start()
        {
            ScrewManger.Instance.Start();
            TcpIpService.Instance.Start();
        }
        public void LoadCCD()
        {

        }
    }
}
